/**
 * Created by yasin on 14-4-14.
 */
var menuHidden = !1,
    toolbarHidden = !1,
    netType = {
        "network_type:wifi": "wifi网络",
        "network_type:edge": "非wifi,包含3G/2G",
        "network_type:fail": "网络断开连接",
        "network_type:wwan": "2g或者3g"
    };
document.addEventListener("WeixinJSBridgeReady", function () {
    document.getElementById("toggleMenuBtn").addEventListener("click", function () {
        menuHidden ? (WeixinJSBridge.call("showOptionMenu"), menuHidden = !1, this.value = "隐藏右上角按钮") : (WeixinJSBridge.call("hideOptionMenu"), menuHidden = !0, this.value = "显示右上角按钮")
    }, !1), document.getElementById("toggleToolbar").addEventListener("click", function () {
        toolbarHidden ? (WeixinJSBridge.call("showToolbar"), toolbarHidden = !1, this.value = "隐藏底部导航栏") : (WeixinJSBridge.call("hideToolbar"), toolbarHidden = !0, this.value = "显示底部导航栏")
    }, !1), document.getElementById("getNetType").addEventListener("click", function () {
        WeixinJSBridge.invoke("getNetworkType", {}, function (e) {
            alert(netType[e.err_msg])
        })
    }, !1)
});